#include "chatuserwid.h"
#include "ui_chatuserwid.h"

ChatUserWid::ChatUserWid(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ChatUserWid)
{
    ui->setupUi(this);
}

ChatUserWid::~ChatUserWid()
{
    delete ui;
}

void ChatUserWid::SetInfo(QString name, QString head, QString online)
{
        _name = name;
        _head = head;
        _online = online;
        // 加载图片
        QPixmap pixmap(_head);

        // 设置图片自动缩放
        ui->icon_lb->setPixmap(pixmap.scaled(ui->icon_lb->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
        ui->icon_lb->setScaledContents(true);

        ui->user_name_lb->setText(_name);
        ui->online_lb->setText(_online);
}

QString ChatUserWid::GetName() const
{
    return _name;
}

QString ChatUserWid::GetOnlineStatus() const
{
    return _online;
}
